/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aderly
 */
@Entity
@Table(name = "grade")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Grade.findAll", query = "SELECT g FROM Grade g"),
    @NamedQuery(name = "Grade.findByGraid", query = "SELECT g FROM Grade g WHERE g.graid = :graid"),
    @NamedQuery(name = "Grade.findByGrahorario", query = "SELECT g FROM Grade g WHERE g.grahorario = :grahorario"),
    @NamedQuery(name = "Grade.findByGradia", query = "SELECT g FROM Grade g WHERE g.gradia = :gradia")})
public class Grade implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "GRAID")
    private Integer graid;
    @Column(name = "GRAHORARIO")
    private Integer grahorario;
    @Size(max = 50)
    @Column(name = "GRADIA")
    private String gradia;
    @JoinColumn(name = "GRALABORATORIO", referencedColumnName = "idlaboratorios")
    @ManyToOne
    private Laboratorios gralaboratorio;
    @JoinColumn(name = "GRADISCIPLINA", referencedColumnName = "iddisciplina")
    @ManyToOne
    private Disciplina gradisciplina;
    @JoinColumn(name = "GRAPROFESSOR", referencedColumnName = "idusuario")
    @ManyToOne
    private Usuario graprofessor;

    public Grade() {
    }

    public Grade(Integer graid) {
        this.graid = graid;
    }

    public Integer getGraid() {
        return graid;
    }

    public void setGraid(Integer graid) {
        this.graid = graid;
    }

    public Integer getGrahorario() {
        return grahorario;
    }

    public void setGrahorario(Integer grahorario) {
        this.grahorario = grahorario;
    }

    public String getGradia() {
        return gradia;
    }

    public void setGradia(String gradia) {
        this.gradia = gradia;
    }

    public Laboratorios getGralaboratorio() {
        return gralaboratorio;
    }

    public void setGralaboratorio(Laboratorios gralaboratorio) {
        this.gralaboratorio = gralaboratorio;
    }

    public Disciplina getGradisciplina() {
        return gradisciplina;
    }

    public void setGradisciplina(Disciplina gradisciplina) {
        this.gradisciplina = gradisciplina;
    }

    public Usuario getGraprofessor() {
        return graprofessor;
    }

    public void setGraprofessor(Usuario graprofessor) {
        this.graprofessor = graprofessor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (graid != null ? graid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Grade)) {
            return false;
        }
        Grade other = (Grade) object;
        if ((this.graid == null && other.graid != null) || (this.graid != null && !this.graid.equals(other.graid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.modelo.Grade[ graid=" + graid + " ]";
    }
    
}
